package com.project.code;

import com.project.code.config.ConfigUtils;
import com.project.code.service.IGenerateService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @Auther: lipengxs
 * @Description: 启动类
 */
@Slf4j
@SpringBootApplication
public class GeneratorApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext ss=SpringApplication.run(GeneratorApplication.class, args);
        try {
            System.out.println("============= generate start ==================");
            String[] tables= ConfigUtils.getTables().split(",");
            ss.getBean(IGenerateService.class).generatorCode(tables);
            System.out.println("============= generate end ==================");
            int code=SpringApplication.exit(ss);
            System.out.println(code);
            //System.exit(1);
        }catch (Exception e){
            e.printStackTrace();
        }

    }

}
